Fix illegal instruction crash on x64 CPUs without POPCNT instruction when compiled...
authorscherek <scherek@outlook.com>
Sat, 12 Jun 2021 14:18:26 +0000 (16:18 +0200)
committerscherek <scherek@outlook.com>
Sat, 12 Jun 2021 14:18:26 +0000 (16:18 +0200)
gtk/gtkpopcountprivate.h

index df2282c985b2a54dce5acf968c71331464e140fb..3862f5cb24178d19697ae5cfbd9da716aeee0581 100644 (file)
@@ -20,7 +20,7 @@
 
 #pragma once
 
-#if defined(_MSC_VER) && !defined (_M_ARM) && !defined (_M_ARM64)
+#if defined(_MSC_VER) && !defined(_M_ARM) && !defined(_M_ARM64) && defined(__AVX__) && defined(__SSE4_2__) && defined(__POPCNT__)
 #include <intrin.h>
 
 static inline guint
@@ -29,7 +29,7 @@ gtk_popcount (guint32 value)
   return __popcnt (value);
 }
 #elif defined(__GNUC__) || defined(__clang__)
-# define gtk_popcount(v) __builtin_popcount(v)
+#define gtk_popcount(v) __builtin_popcount (v)
 #else
 static inline guint
 gtk_popcount (guint32 value)